import React, { Component } from 'react'

export default class Video extends Component {
    
    state = {
        src: 'http://api.xiaohigh.com:8090/video/random'
    }

    render() {
        return (
            <div className="video-container">
                <video src={this.state.src} height="500" controls onClick={this.change}></video>
            </div>
        )
    }

    // //事件的回调
    // change = () => {
    //     //改变视频, 调用父级组件中 change 方法
    // }

    change = () => {
        this.setState({
            src: 'http://api.xiaohigh.com:8090/video/random?t='+Date.now()
        })
    }
}
